<include file="public@header"/>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInUp">
    <div class="row">
        <div class="col-sm-3">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div class="list-group">
                        <a class="list-group-item" href="#A" data-toggle="tab">基本属性</a>
                        <a class="list-group-item" href="#B" data-toggle="tab">SEO设置</a>
                        <a class="list-group-item" href="#C" data-toggle="tab">模板设置</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-9">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加分类</h5>
                    <div class="ibox-tools">
                        <a href="{:url('AdminCategory/index')}" class="btn btn-primary btn-xs">分类管理</a>
                        <a href="{:url('AdminCategory/add')}" class="btn btn-primary btn-xs">添加分类</a>
                        <a href="#" class="btn btn-primary btn-xs active">编辑分类</a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal js-ajax-form" action="{:url('AdminCategory/editPost')}" method="post">
                        <div class="tab-content">
                            <div class="tab-pane active" id="A">
                                <div class="form-group">
                                    <label for="input-parent"><span class="form-required">*</span>上级</label>
                                    <div>
                                        <select class="form-control" name="parent_id" id="input-parent">
                                            <option value="0">作为一级分类</option>
                                    {$categories_tree}
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="input-name"><span class="form-required">*</span>分类名称</label>
                                    <div>
                                        <input type="text" class="form-control" id="input-name" name="name" value="{$name}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="input-name">分类别名</label>
                                    <div>
                                        <input type="text" class="form-control" id="input-alias" name="alias" value="{$alias|default=''}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="input-description">描述</label>
                                    <div>
                                        <textarea class="form-control" name="description" id="input-description">{$description}</textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="input-description">缩略图</label>
                                    <div>
                                        <input type="hidden" name="more[thumbnail]" class="form-control" value="{$more.thumbnail|default=''}" id="js-thumbnail-input">
                                        <div>
                                            <a href="javascript:uploadOneImage('图片上传','#js-thumbnail-input');">
                                            <if condition="empty($more.thumbnail)">
                                            <img src="__TMPL__/public/assets/images/default-thumbnail.png" id="js-thumbnail-input-preview" width="135" style="cursor: pointer"/>
                                            <else/>
                                            <img src="{:cmf_get_image_preview_url($more.thumbnail)}" id="js-thumbnail-input-preview" width="135" style="cursor: pointer"/>
                                            </if>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="tab-pane" id="B">
                                <div class="form-group">
                                    <label for="input-seo_title">SEO标题</label>
                                    <div>
                                        <input type="text" class="form-control" id="input-seo_title" name="seo_title" value="{$seo_title}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="input-seo_keywords">SEO关键字</label>
                                    <div>
                                        <input type="text" class="form-control" id="input-seo_keywords" name="seo_keywords" value="{$seo_keywords}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="input-seo_description">SEO描述</label>
                                    <div>
                                        <textarea class="form-control" name="seo_description" id="input-seo_description">{$seo_description}</textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="tab-pane" id="C">
                                <div class="form-group">
                                    <label for="input-list_tpl"><span class="form-required">*</span>列表模板</label>
                                    <div>
                                        <select class="form-control" name="list_tpl" id="input-list_tpl">
                                            <!--<option value="list">portal/list.html(默认)</option>
                                            -->
                                            <foreach name="list_theme_files" item="vo">
                                            <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                            <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                            </foreach>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="input-one_tpl"><span class="form-required">*</span>文章模板</label>
                                    <div>
                                        <select class="form-control" name="one_tpl" id="input-one_tpl">
                                            <!--<option value="article">portal/article.html(默认)</option>
                                            -->
                                            <foreach name="article_theme_files" item="vo">
                                            <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                            <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                            </foreach>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed">
                        </div>
                        <div class="form-group">
                            <input type="hidden" name="id" value="{$id}">
                            <button type="submit" class="btn btn-primary js-ajax-submit" data-refresh="0">{:lang('SAVE')}
                            </button>
                            <a class="btn btn-default" href="{:url('AdminCategory/index')}">{:lang('BACK')}</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    $('#input-list_tpl').val("{$list_tpl|default=''}");
    $('#input-one_tpl').val("{$one_tpl|default=''}");
</script>
</body>
</html>